<!--环境咨询事业部envirConsultingStatistics的编辑弹窗-->
<template>
    <div class="mycontainer">
        <el-form :label-position="labelPosition" ref="form" :model="form" >
            <el-row>
                <el-col span="9">
                <el-form-item label="项目编号：">
                    <el-input v-model="form.projectId" :disabled="true"></el-input>
                </el-form-item>
                </el-col>
                <el-col span="9" :offset="6">
                    <el-form-item label="领取编号日期：">
                    <el-input v-model="form.idGetDate" :disabled="true"></el-input>
                </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col span="9">
                <el-form-item label="业主名称：">
                    <el-input v-model="form.customName" :disabled="true"></el-input>
                </el-form-item>
                </el-col>
                <el-col span="9" :offset="6">
                     <el-form-item label="项目名称：">
                    <el-input v-model="form.projectName" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col span="9">
                    <el-form-item label="项目进展：">
                        <el-input v-model="form.projectProgess" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
                <el-col span="9" :offset="6">
                    <el-form-item label="项目区域：">
                        <el-input v-model="form.projectArea" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col span="9">
                    <el-form-item label="合同金额（元）：">
                        <el-input v-model="form.contractAmount" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
                <el-col span="9" :offset="6">
                    <el-form-item label="项目类型:">
                        <el-input v-model="form.projectType" placeholder="请输入内容" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col span="9">
                    <el-form-item label="项目经理：">
                        <el-input placeholder="请输入内容" v-model="form.projectManager" ></el-input>
                    </el-form-item>
                </el-col>
                <el-col span="9" :offset="6">
                    <el-form-item label="审批部门:">
                        <!-- placeholder="请输入内容"-->
                        <el-input v-model="form.approvalDepartment" :disabled="true"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col span="9">
                <el-form-item label="上报报批报告时间：">
                    <el-date-picker v-model="form.reportingTime" type="date" placeholder="选择日期" format="yyyy-MM-dd " value-format="yyyy-MM-dd hh:mm:ss" style="width:100%;"></el-date-picker>
                </el-form-item>
                </el-col>
                <el-col span="9" :offset="6">
                    <el-form-item label="已提计件绩效金额（元）:">
                        <el-input placeholder="请输入内容" v-model="form.performanceAmount" oninput ="value=value.replace(/[^0-9.]/g,'')"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
             <el-row>
                <el-col span="9">
                    <el-form-item label="项目投资（元）：">
                        <el-input placeholder="请输入内容" v-model="form.engineerInvestment" oninput ="value=value.replace(/[^0-9.]/g,'')"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col span="24">
                <el-form-item label="备注:">
                    <el-input type="textarea" v-model="form.remark" placeholder="请输入内容"></el-input>
                </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <span style="text-align:center;display:block;">
              <el-button @click="offSubmit" style="margin-right:20px;">取消</el-button>
              <el-button type="primary" @click="onSubmit">确定</el-button>
        </span>
    </div>
</template>
 
<script>
import { InvitationStatisticsTable } from '@/api/bigdata.js';
export default {
  components: {},
  data () {
    return {
      labelPosition: 'top',
      form: {
        idGetDate: '',
        projectId: '',
        projectName: '',
        customName: '',
        contractAmount: '',
        projectType: '',
        projectManager: '',
        projectArea: '',
        approvalDepartment: '',
        engineerInvestment: '',
        reportingTime: '',
        performanceAmount: '',
        projectProgess: '',
        remark: ''
      }
    }
  },
  methods: {
    dataInit (data) {
      if (data) {
        this.form = data;
        console.info(data);
      }
    },
    offSubmit () {
      this.$emit('closeWindow');
    },
    onSubmit () {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          let params = {
            ...this.form
          }
          return new Promise((resolve, reject) => {
            InvitationStatisticsTable.updateEnvirConsult(this, params).then(res => {
              this.$message({
                showClose: true,
                message: '编辑成功！',
                type: 'success',
                offset: '300',
                onClose: () => {
                  this.$emit('updateWindow');
                }
              });
            }).catch(e => {
              reject(e);
            });
          });
        } else {
          this.$message({
            showClose: true,
            message: '编辑失败！',
            type: 'error',
            offset: '300'
          });
          return false;
        }
      });
    }
  }
}
</script>
<style>
    .mycontainer {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
    }
</style>
